home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / -seriously_amiga- / shareware / misc / identify / include / inline / identify.h
C/C++ Source or Header  |  1997-12-12  |  4KB  |  138 lines

  1. #ifndef _INLINE_IDENTIFY_H
  2. #define _INLINE_IDENTIFY_H
  3.  
  4. #include <sys/cdefs.h>
  5. #include <inline/stubs.h>
  6.  
  7. __BEGIN_DECLS
  8.  
  9. #ifndef BASE_EXT_DECL
  10. #define BASE_EXT_DECL
  11. #define BASE_EXT_DECL0 extern struct Library * IdentifyBase;
  12. #endif
  13. #ifndef BASE_PAR_DECL
  14. #define BASE_PAR_DECL
  15. #define BASE_PAR_DECL0 void
  16. #endif
  17. #ifndef BASE_NAME
  18. #define BASE_NAME IdentifyBase
  19. #endif
  20.  
  21. BASE_EXT_DECL0
  22.  
  23. static __inline LONG
  24. IdAlert (BASE_PAR_DECL ULONG code, struct TagItem *taglist)
  25. {
  26.   BASE_EXT_DECL
  27.   register LONG _res __asm("d0");
  28.   register struct Library *a6 __asm("a6") = BASE_NAME;
  29.   register ULONG d0 __asm("d0") = code;
  30.   register struct TagItem * a0 __asm("a0") = taglist;
  31.   __asm __volatile ("jsr a6@(-42)"
  32.   : "=r" (_res)
  33.   : "r" (a6), "r" (a0), "r" (d0)
  34.   : "a0","a1","d0","d1", "memory");
  35.   return _res;
  36. }
  37. #ifndef NO_INLINE_STDARG
  38. #define IdAlertTags(d0, tags...) \
  39.   ({ struct TagItem _tags[] = { tags }; IdAlert ((d0), _tags); })
  40. #endif /* not NO_INLINE_STDARG */
  41.  
  42. static __inline LONG
  43. IdExpansion (BASE_PAR_DECL struct TagItem *taglist)
  44. {
  45.   BASE_EXT_DECL
  46.   register LONG _res __asm("d0");
  47.   register struct Library *a6 __asm("a6") = BASE_NAME;
  48.   register struct TagItem * a0 __asm("a0") = taglist;
  49.   __asm __volatile ("jsr a6@(-30)"
  50.   : "=r" (_res)
  51.   : "r" (a6), "r" (a0), "r" (d0)
  52.   : "a0","a1","d0","d1", "memory");
  53.   return _res;
  54. }
  55. #ifndef NO_INLINE_STDARG
  56. #define IdExpansionTags(tags...) \
  57.   ({ struct TagItem _tags[] = { tags }; IdExpansion (_tags); })
  58. #endif /* not NO_INLINE_STDARG */
  59.  
  60. static __inline STRPTR
  61. IdHardware (BASE_PAR_DECL ULONG type, struct TagItem *taglist)
  62. {
  63.   BASE_EXT_DECL
  64.   register STRPTR _res __asm("d0");
  65.   register struct Library *a6 __asm("a6") = BASE_NAME;
  66.   register ULONG d0 __asm("d0") = type;
  67.   register struct TagItem * a0 __asm("a0") = taglist;
  68.   __asm __volatile ("jsr a6@(-36)"
  69.   : "=r" (_res)
  70.   : "r" (a6), "r" (a0), "r" (d0)
  71.   : "a0","a1","d0","d1", "memory");
  72.   return _res;
  73. }
  74. #ifndef NO_INLINE_STDARG
  75. #define IdHardwareTags(d0, tags...) \
  76.   ({ struct TagItem _tags[] = { tags }; IdHardware ((d0), _tags); })
  77. #endif /* not NO_INLINE_STDARG */
  78.  
  79. static __inline LONG
  80. IdFunction (BASE_PAR_DECL STRPTR name, LONG offset, struct TagItem *taglist)
  81. {
  82.   BASE_EXT_DECL
  83.   register LONG _res __asm("d0");
  84.   register struct Library *a6 __asm("a6") = BASE_NAME;
  85.   register STRPTR a0 __asm("a0") = name;
  86.   register LONG d0 __asm("d0") = offset;
  87.   register struct TagItem * a1 __asm("a1") = taglist;
  88.   __asm __volatile ("jsr a6@(-48)"
  89.   : "=r" (_res)
  90.   : "r" (a6), "r" (a0), "r" (d0)
  91.   : "a0","a1","d0","d1", "memory");
  92.   return _res;
  93. }
  94. #ifndef NO_INLINE_STDARG
  95. #define IdFunctionTags(a0, d0, tags...) \
  96.   ({ struct TagItem _tags[] = { tags }; IdFunction ((a0), (d0), _tags); })
  97. #endif /* not NO_INLINE_STDARG */
  98.  
  99. static __inline ULONG
  100. IdHardwareNum (BASE_PAR_DECL ULONG type, struct TagItem *taglist)
  101. {
  102.   BASE_EXT_DECL
  103.   register ULONG _res __asm("d0");
  104.   register struct Library *a6 __asm("a6") = BASE_NAME;
  105.   register ULONG d0 __asm("d0") = type;
  106.   register struct TagItem * a0 __asm("a0") = taglist;
  107.   __asm __volatile ("jsr a6@(-54)"
  108.   : "=r" (_res)
  109.   : "r" (a6), "r" (a0), "r" (d0)
  110.   : "a0","a1","d0","d1", "memory");
  111.   return _res;
  112. }
  113. #ifndef NO_INLINE_STDARG
  114. #define IdHardwareNumTags(d0, tags...) \
  115.   ({ struct TagItem _tags[] = { tags }; IdHardwareNum ((d0), _tags); })
  116. #endif /* not NO_INLINE_STDARG */
  117.  
  118. static __inline void
  119. IdHardwareUpdate (void)
  120. {
  121.   BASE_EXT_DECL
  122.   register struct Library *a6 __asm("a6") = BASE_NAME;
  123.   __asm __volatile ("jsr a6@(-60)"
  124.   : "r" (a6)
  125.   : "memory");
  126. }
  127.  
  128.  
  129. #undef BASE_EXT_DECL
  130. #undef BASE_EXT_DECL0
  131. #undef BASE_PAR_DECL
  132. #undef BASE_PAR_DECL0
  133. #undef BASE_NAME
  134.  
  135. __END_DECLS
  136.  
  137. #endif /* _INLINE_IDENTIFY_H */
  138.